package com.txts.road.app.system.controller;

import com.txts.road.app.system.service.AppVersionService;
import com.txts.base.common.domain.ResponseDTO;
import io.swagger.v3.oas.annotations.Operation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.*;

/**
 * 版本更新前端控制层
 *
 * @author baoyanrong
 * @since 2025-07-17 13:34
 */
@Tag(name = "版本更新接口")
@RestController
@RequestMapping("/api/v1/app-version")
@RequiredArgsConstructor
public class AppVersionController {
    private final AppVersionService appVersionService;

    /**
     * 检查版本更新
     */
    @Operation(summary = "检查版本更新")
    @GetMapping("/version/check")
    public ResponseDTO<Boolean> checkVersion(@Parameter(description = "平台类型 1-越野APP 2-其他", example = "1") @RequestParam Integer platformType,
                                   @Parameter(description = "当前版本号", example = "1.0.0") @RequestParam String currentVersion) {
        return ResponseDTO.ok(appVersionService.checkVersion(platformType, currentVersion));
    }

}
